package com.ruoyi;

import com.ruoyi.system.annotation.EnableRyFeignClients;



import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import tk.mybatis.spring.annotation.MapperScan;

@EnableTransactionManagement
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableDiscoveryClient
@EnableRyFeignClients
//开启定时任务
@EnableScheduling
//开启异步执行
@EnableAsync
@MapperScan("com.ruoyi.*.mapper")
public class JacLabApp {

/*    @Bean(name="processExecutor")
    public TaskExecutor workExecutor() {
        ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
        threadPoolTaskExecutor.setThreadNamePrefix("Async-");
        threadPoolTaskExecutor.setCorePoolSize(60);
        threadPoolTaskExecutor.setMaxPoolSize(120);
        threadPoolTaskExecutor.setQueueCapacity(600);
        threadPoolTaskExecutor.afterPropertiesSet();

        // 自定义拒绝策略
        threadPoolTaskExecutor.setRejectedExecutionHandler((r, executor) -> {
            // .....
        });
        // 使用预设的拒绝策略
        threadPoolTaskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());

        return threadPoolTaskExecutor;
    }*/
    public static void main(String[] args) {
        SpringApplication.run(JacLabApp.class,args);
        System.out.println("服务启动成功!");
    }
}
